package main.scene
{
	import com.D5Power.Controler.Actions;
	import com.D5Power.Controler.CharacterControler;
	import com.D5Power.Objects.CharacterObject;
	import com.D5Power.Objects.NCharacterObject;
	import com.D5Power.Stuff.HSpbar;
	import com.D5Power.graphicsManager.GraphicsResource;
	import com.D5Power.mission.EventData;
	import com.D5Power.mission.MissionData;
	import com.D5Power.scene.D5Scene;
	import main.ui.ChatWin;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Stage;
	
	public class MyScene extends D5Scene
	{		
		public function MyScene(stg:Stage, container:DisplayObjectContainer)
		{
			super(stg, container);
		}
		
		public function chat(args:*):void
		{
			ChatWin.my.showchat(args[1]);
		}		
		
		override public function missionCallBack(npcname:String,say:String,event:EventData, miss:Vector.<MissionData>,obj:NCharacterObject):void
		{
			var misid:uint=0;
			var type:uint = 0;
			var complate:Boolean=false;
			if(miss!=null && miss.length!=0)
			{
				if(miss.length==1)
				{
					say = "<font color='#FF9900'>" + miss[0].name + "</font><br><br>"+miss[0].info;
					misid = miss[0].id;
					type = miss[0].type;
					complate = miss[0].isComplate;
				}else{
					for each(var data:MissionData in miss)
					{
						say+= "<br>任务："+data.name+"（完成状态）";
					}
				}
			}else{
				say = "<font color='#FF9900'>" + npcname + "</font><br><br>" + say;
			}
			Wulin.my.npcWindow(say,event,obj,misid,type,complate);
		}
		
		public function buildPlayer(startX:uint,startY:uint):void
		{
			if(player==null)
			{
				player = new CharacterObject(null);
				player.changeController(new CharacterControler(perc,CharacterControler.MOUSE));
				player.ID=1;
				
				var g:GraphicsResource = new GraphicsResource('','',1,1,0,true);
				g.addLoadResource(['asset/character/1/body/boy0_stand.png','asset/character/1/body/boy0_stand_head.png'],Actions.Stop,2,5,1);
				g.addLoadResource(['asset/character/1/body/boy0_walk.png','asset/character/1/body/boy0_walk_head.png'],Actions.Run,8,5,12);
				player.graphicsRes = g;
				
				player.render = render_pc;
				player.speed=3.6;
				
				player.setName(WulinGlobal.username);
				
				player.hpMax = 100;
				player.hp = 80;
				player.hpBar = new HSpbar(player,'hp','hpMax', 0);
			}
			
			player.reSetPos(startX,startY);
			createPlayer(player);
		}
	}
}